package com.example.service.impl;

import com.example.mapper.DeptLogMapper;
import com.example.mapper.EmpMapper;
import com.example.pojo.DeptLog;
import com.example.pojo.Emp;
import com.example.service.DeptLogService;
import com.example.service.EmpService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class DeptLogServiceImpl implements DeptLogService {

    @Resource
    private DeptLogMapper deptLogMapper;

    /**
     * 此方法的注解会生成一个新事物 不受掉他方法所在的事务的影响
     * @param deptLog
     */
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void insert(DeptLog deptLog) {
        deptLogMapper.insert(deptLog);
    }
}
